import { Button, Input, Popconfirm, Switch, Checkbox, Card, message, Radio } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import type { ProColumns, ActionType } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { 
  getCategoryListByPage,
  getBrandListByPage,
  getGoodsList, 
  doCreateGoods, 
  deleteGoods, 
  updateGoods, 
  updateGoodsStauts 
} from '@/services/stockGoods/api';
import { OptType } from '@/utils/constants';
import { ProFormFieldSet } from '@ant-design/pro-form';
import StatisticsCard from '@/components/StatisticsCard/Index';
import BreadcrumbDept from '@/components/BreadcrumbDept';




const StockList: React.FC = () => {
 
  const columns: ProColumns<STOCKGOODSAPI.GoodsItem>[] = [
    {
      title: '统计周期',
      dataIndex: 'class_id',
      hideInTable: true,
      valueType: 'dateRange'
    },
    {
      title: '护工编号',
      dataIndex: 'class_id',
    },
    {
      title: '护工姓名',
      dataIndex: 'brand_id'
    },
    {
      title: '统计方式',
      dataIndex: 'class_id',
      hideInTable: true,
      valueType: 'radio',
      renderFormItem: () => {
        return <Radio.Group options={[
          {
            label: '按服务周期统计',
            value: 0
          },
          {
            label: '按结算周期统计',
            value: 1
          }
        ]}>

        </Radio.Group>;
      }
    },
    {
      title: '患者姓名',
      dataIndex: 'goods_id',
      search: false
    },
    {
      title: '住院号/身份证号',
      dataIndex: 'goods_id',
      search: false
    },
    {
      title: '服务开始时间',
      dataIndex: 'goods_name',
      search: false
    },
    {
      title: '服务结束时间',
      dataIndex: 'brand_name',
      search: false
    },
    {
      title: '核算天数',
      dataIndex: 'goods_name',
      search: false
    },
    {
      title: '服务计费',
      dataIndex: 'specs_num',
      search: false
    },
    {
      title: '管理费',
      search: false
    }
  ];

  return (
    <PageContainer extra={[
      <BreadcrumbDept />
     ]}>
      <ProTable<STOCKGOODSAPI.GoodsItem, STOCKGOODSAPI.GoodsItem & COMMON.PageParams>
        
        rowKey="goods_id"
        bordered
        search={{
          span: 8,
          optionRender: (searchConfig, formProps, dom) => {
            dom.shift();
            return [
              ...dom,
              <Button key="export" type="primary">导出报表</Button>
            ]
          }
        }}
        request={async (params) => {
          return {
            data: [],
            success: true,
            total: 0
          };
        }}
        columns={columns}
        scroll={{ x : 1000 }}
        tableExtraRender={(_, data) => (
          <div>
            <div style={{marginBottom: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
              <StatisticsCard iconType="database" title="总服务单数" number={200}/>
              <StatisticsCard title="总服务患者数" iconType="database" number="50000.00"/>
              <StatisticsCard title="服务费汇总" number={5}/>
              <StatisticsCard style={{marginRight: 0}} title="管理费汇总" number="￥1230.00"/>
            </div>
          </div>
        )}
      />
    </PageContainer>
  );
};
export default StockList;
